namespace Wips.Domain.Models.Authorities.Model;

/// <summary>
/// 用户与角色关联
/// </summary>
[Table("AuthorityUserRoles")]
[SugarTable("AuthorityUserRoles")]
public class UserRole : ValueObjectBase
{
    /// <summary>
    /// 用户ID
    /// </summary>
    /// <value></value>
    public string UserId { get; set; }

    /// <summary>
    /// 用户
    /// </summary>
    /// <value></value>
    [Navigate(NavigateType.ManyToOne, nameof(UserId))]
    public User User { get; set; }

    /// <summary>
    /// 角色ID
    /// </summary>
    /// <value></value>
    public string RoleId { get; set; }

    /// <summary>
    /// 角色
    /// </summary>
    /// <value></value>
    [Navigate(NavigateType.ManyToOne, nameof(RoleId))]
    public Role Role { get; set; }

    public UserRole()
    {
    }

    public UserRole(string userId, string roleId)
    {
        UserId = userId;
        RoleId = roleId;
    }
}